package com.sgj.handler;

import com.alibaba.cola.statemachine.Action;
import com.alibaba.fastjson.JSON;
import com.sgj.entity.Order;
import com.sgj.enums.OrderEventEnum;
import com.sgj.enums.OrderStatusEnum;
import org.springframework.stereotype.Component;

/**
 * @Author: Guoji Shen
 * @Date: 2023/11/6 11:25
 */
@Component
public class UserCloseAction implements Action<OrderStatusEnum, OrderEventEnum, Order> {

    @Override
    public void execute(OrderStatusEnum from, OrderStatusEnum to, OrderEventEnum event, Order context) {
        System.out.println("用户关闭流程开始走了");
        System.out.println("从这个状态-【" + from.getInfo() + "】-转为+【" + to.getInfo() + "】 的状态");
        System.out.println("上下文信息：" + JSON.toJSONString(context));
        System.out.println("中间执行的一些操作.......");
        System.out.println("用户关闭流程完毕了");
    }
}
